<?php
namespace app\home\controller;
use app\home\model\ShoppingModel;
use app\home\controller\Goodsactive;
use think\Controller;
use app\home\controller\Images;
use think\Request;
class Shopping extends Controller{

    public function index(){

        //轮播图
        $img = new ShoppingModel();
        $img = $img->getImages();
        $this->assign('img',$img);


        // 今日必抢
        $row = new Goodsactive;
        $row = $row->index();
//        echo "<pre>";
//        print_r($row);
//        exit;
        $this->assign('active',$row);

        //精选特卖
        $specials = new Specialsale();
        $specials= $specials->index();
        $this->assign('specials',$specials);

        // 主题推送
        $theme = new Theme();
        $theme = $theme->index();
        $this->assign('theme',$theme);
        return $this->fetch();
    }

    public function getNum(){
        if(Request::instance()->isPost()){
            $limit =input('limit');
            $limit =intval($limit);
            $num = new ShoppingModel();
            $num= $num->getLimit($limit);
            return $num;
        }else{
            return false;
        }
    }
}